package com.kpmg.datalake.common.enums;

import java.util.HashSet;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;

/**
 * @author Alex.zhao [alex.zhao@kpmg.com]
 * @since Created on azhao6 on 2018-08-20 11:33:24 主题
 */
public enum TopicEnum {
  /**
   * INIT_DB("initDb","初始化db","")
   */
  INIT_DB("initDb", "初始化db", ""),
  /**
   * INIT_DATA("initData","初始化数据","")
   */
  INIT_DATA("initData", "初始化数据", ""),
  /**
   * "TrialBalance", "余额表"
   */
  TRIAL_BALANCE("TrialBalance", "余额表", "TrialBalance"),
  /**
   * "Journal", "序时账"
   */
  JOURNAL("Journal", "序时账", "Journal"),
  /**
   * "MultiAnalysis", "报表"
   */
  MULTI_ANALYSIS("MultiAnalysis", "报表", "MultiAnalysis"),
  /**
   * "IReconciliation", "内部对账"
   */
  I_RECONCILIATION("IReconciliation", "内部对账", "IReconciliation"),
  /**
   * "AutoPKG", "Auto PKG"
   */
  AUTO_PKG("AutoPKG", "Auto PKG", "AutoPKG");
  private String code;
  private String display;
  private String outCode;

  TopicEnum(String code, String display, String outCode) {
    this.code = code;
    this.display = display;
    this.outCode = outCode;
  }

  /**
   * 获取外部接口 topic 列表
   *
   * @return 类别信息
   */
  public static Set<String> getOutCodeSet() {
    Set<String> hashSet = new HashSet<>();
    for (TopicEnum item : TopicEnum.values()) {
      if (StringUtils.isNotBlank(item.getOutCode())) {
        hashSet.add(item.outCode);
      }
    }
    return hashSet;
  }

  public String getCode() {
    return code;
  }

  public String getDisplay() {
    return display;
  }

  public String getOutCode() {
    return outCode;
  }
}
